﻿using System;
using System.Collections.Generic;
using System.Text;
using TomShane.Neoforce.Controls;
using RebEngine.Managers;
using Microsoft.Xna.Framework.Graphics;
using RebellionII.GameObjects.Units.Instances;

namespace RebellionII.GUI.Parts
{

    public class RebUnitBox
    {
        public Panel pnlItem { get; set; }
        public Label lblName { get; set; }
        public ImageBox imgImage { get; set; }

        public int UnitReferenceID { get; set; }

        public RebUnitBox(Control named, int x, int y, int referenceID)
        {
            UnitReferenceID = referenceID;
            
            pnlItem = new Panel(InputManager.Manager);
            pnlItem.Init();
            pnlItem.Left = 3 + x;
            pnlItem.Top = 3 + y;
            pnlItem.Width = 100;
            pnlItem.Height = 80;
            named.Add(pnlItem);

            lblName = new Label(InputManager.Manager);
            lblName.Init();
            lblName.Left = 5;
            lblName.Top = 65;
            lblName.Width = 90;
            lblName.Height = 13;
            lblName.Text = NetClientManager.UnitList[UnitReferenceID].sName;
            
            pnlItem.Add(lblName);

            imgImage = new ImageBox(InputManager.Manager);
            imgImage.Init();
            imgImage.Left = 5;
            imgImage.Top = 10;
            imgImage.Width = 90;
            imgImage.Height = 45;

            imgImage.Image = TextureManager.GetTexture(NetClientManager.UnitList[UnitReferenceID].sTextureName).BaseTexture as Texture2D;
            imgImage.SizeMode = SizeMode.Stretched;
            pnlItem.Add(imgImage);
        }
    }
}
